import fetch from 'utils/fetch';

// 查询学校名称
export function querySchoolByName(schoolName) {
    const data = {
        schoolName
    };
    return fetch({
        url: '/school/querySchoolByName',
        method: 'post',
        data
    });
}

// 查询班级
export function queryClassBySchool(schoolId) {
    const data = {
        schoolId
    };
    return fetch({
        url: '/class/getClassListBySchoolId',
        method: 'post',
        data
    });
}


//1. 添加摄像头
export function saveLiveDevice(sSchoolId,sClassId,sArea,sAreaName,sAngleView,sVideoNumber,sVideoCode,sManuFactory,sNvrNumber,sNvrCode,sChannelNumber) {
    const data = {
        sSchoolId,//学校id
        sClassId,//班级id
        sArea,//区域类型id
        sAreaName,//区域类型名称
        sAngleView,//视角名称
        sVideoNumber,//摄像机设备序列号
        sVideoCode,//摄像机设备验证码
        sManuFactory,//生产厂家 1海康摄像头  2大华摄像头
        sNvrNumber,//NVR设备序列号
        sNvrCode,//NVR设备验证码
        sChannelNumber//通道号
    };
    return fetch({
        url: '/liveDevice/saveLiveDevice',
        method: 'post',
        data
    });
}

//2. 删除摄像头
export function removeLiveDevice(pId) {
    const data = {
        pId//摄像头记录id
    };
    return fetch({
        url: '/liveDevice/removeLiveDevice',
        method: 'post',
        data
    });
}

//3.  修改视角名称
export function updateAngleView(pId,sAngleView) {
    const data = {
        pId,//摄像头记录id
        sAngleView//视角名称
    };
    return fetch({
        url: '/liveDevice/updateAngleView',
        method: 'post',
        data
    });
}

//4. 分页查询设备列表
export function pageLiveDevice(page,rows,provinceId,cityId,areaId,
    sSchoolId,
    sClassId,sVideoNumber) {
    const data = {
        page,
        rows,
        provinceId,
        cityId,
        areaId,
        sSchoolId,
        sClassId,
        sVideoNumber
    };
    return fetch({
        url: '/liveDevice/pageLiveDevice',
        method: 'post',
        data
    });
}

//5. 5. 获取安装区域
export function listAreas() {
    const data = {
    };
    return fetch({
        url: '/liveDevice/listAreas',
        method: 'post',
        data
    });
}


// 1.获取所有学校的一卡通配置列表\
export function findSettlementConfigByPage( page, rows, provinceId, cityId, areaId, schoolId ) {
    const data = {
        page, 
        rows, 
        provinceId, 
        cityId, 
        areaId, 
        schoolId
    };
    return fetch({
        url: '/settlementConfig/findSettlementConfigByPage/'+page+'/'+rows,
        method: 'post',
        data
    });
}

// 2.添加学校一卡通配置
export function addSettlementConfig( fSchoolId, sPublicNetworkIp, sPort ) {
    const data = {
        fSchoolId, 
        sPublicNetworkIp, 
        sPort
    };
    return fetch({
        url: '/settlementConfig/addSettlementConfig',
        method: 'post',
        data
    });
}

// 3. 获取学校一卡通配置信息
export function getSettlementConfigDetail( id ) {
    const data = {
        id
    };
    return fetch({
        url: '/settlementConfig/getSettlementConfigDetail',
        method: 'post',
        data
    });
}

// 4. 修改学校一卡通配置信息
export function updateSettlementConfig( pId, sPublicNetworkIp, sPort ) {
    const data = {
        pId, 
        sPublicNetworkIp, 
        sPort
    };
    return fetch({
        url: '/settlementConfig/updateSettlementConfig',
        method: 'post',
        data
    });
}

// 学校屏保信息分页
export function querySchoolByPage(json) {
    const data = {...json};
    return fetch({
        url: '/wisDom/querySchoolByPage',
        method: 'post',
        data
    });
}

// 获取屏保信息
export function getScreenSaverInfo(json) {
    const data = {...json};
    return fetch({
        url: '/wisDom/getScreenSaverInfo',
        method: 'post',
        data
    });
}

// 屏保图片展示
export function pageWisdomScreensaver(json) {
    const data = {...json};
    return fetch({
        url: '/wisDom/pageWisdomScreensaver',
        method: 'post',
        data
    });
}

// 保存锁屏时间，屏保设置页面
export function updateWisdomScreensaverTime(json) {
    const data = {...json};
    return fetch({
        url: '/wisDom/updateWisdomScreensaverTime',
        method: 'post',
        data
    });
}

// 删除图片
export function deletepicture(json) {
    const data = {...json};
    return fetch({
        url: '/wisDom/deletepicture',
        method: 'post',
        data
    });
}

// 修改屏保
export function editPicture(json) {
    const data = {...json};
    return fetch({
        url: '/wisDom/editPicture',
        method: 'post',
        data
    });
}

// 回填编辑屏保
export function getPicture(json) {
    const data = {...json};
    return fetch({
        url: '/wisDom/getPicture',
        method: 'post',
        data
    });
}

//新增/修改屏保
export function savePicture(json) {
    const data = {...json};
    return fetch({
        url: '/wisDom/savePicture',
        method: 'post',
        data
    });
}